package zucc.edu.cn.chengchengparttime.Mysignup;

import zucc.edu.cn.chengchengparttime.R;
import zucc.edu.cn.chengchengparttime.Text;

import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MysignupFragment extends Fragment {
    private RecyclerView rv;
    private MysignupAdapter mysignupAdapter;
    private Context context;
    private List<Text> data=new ArrayList<>(); //数据列表
    private ImageView line1,line2,line3,line4;
    private TextView text1,text2,text3,text4;

    public MysignupFragment(){}

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState){
        View view = inflater.inflate(R.layout.fragment_mysignup, container, false);
        context = this.getActivity();
        rv = view.findViewById(R.id.rv);

        Text t=new Text("图书馆图书整理","图书馆 | 每周一至周五","√已录取","15/小时","月结");
        data.add(t);
        Text t2=new Text("体测工作人员","体育室 | 周一18:00-19:00","√已录取","16/小时","月结");
        data.add(t2);
        Text t3=new Text("图书馆图书整理2","图书馆 | 每周一至周五","√已录取","15/小时","月结");
        data.add(t3);
        Text t4=new Text("图书馆图书整理3","图书馆 | 每周一至周五","√已录取","15/小时","月结");
        data.add(t4);
        Text t5=new Text("图书馆图书整理4","图书馆 | 每周一至周五","√已录取","15/小时","月结");
        data.add(t5);

        //适配器的定义与设置
        mysignupAdapter=new MysignupAdapter(data,context);
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this.getActivity());
        linearLayoutManager.setOrientation(RecyclerView.VERTICAL);
        rv.setLayoutManager(linearLayoutManager);
        rv.setAdapter(mysignupAdapter);

        line1=view.findViewById(R.id.underline1);
        line2=view.findViewById(R.id.underline2);
        line3=view.findViewById(R.id.underline3);
        line4=view.findViewById(R.id.underline4);
        line2.setVisibility(View.GONE);
        line3.setVisibility(View.GONE);
        line4.setVisibility(View.GONE);

        text1=view.findViewById(R.id.all);
        text1.getPaint().setFakeBoldText(true); //字体动态设置加粗

        return view;
    }
}
